﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using UnityEngine;

public static class AIUtility
{
    [CompilerGenerated]
    private static Func<Asset, bool> <>f__am$cache0;

    public static AI CreateHumanoidAI(Vector3 position)
    {
        Character comp = CharacterUtility.CreateHumanoidCharacter(position);
        comp.name = "AI";
        AI ai = comp.AddComponent<AI>();
        comp.AddComponent<AITargetDetector>().penetrateWalls = true;
        comp.AddComponent<AIMove>();
        comp.AddComponent<AILook>();
        comp.AddComponent<AIAttack>();
        comp.AddComponent<AIItemDetector>();
        comp.isInfinteEnergy = true;
        if (<>f__am$cache0 == null)
        {
            <>f__am$cache0 = x => x.gameObject.GetComponent<Suit>() != null;
        }
        IEnumerable<Asset> enumerable = AssetManager.GetAllSuitAssets().Where<Asset>(<>f__am$cache0);
        Inventory component = comp.GetComponent<Inventory>();
        NetworkUtility.Spawn(comp.gameObject);
        component.CreateSuit(enumerable.GetRandomElement<Asset>().name);
        return ai;
    }
}

